        <style type="text/css">
        @import url(<?php echo $this->webroot;?>css/flash_chart_style.css);
        </style>
        <script src="<?php echo $this->webroot;?>js/openflashchart/js/swfobject.js" type="text/javascript"></script>
        <script type="text/javascript" src="<?php echo $this->webroot;?>js/openflashchart/js/json2.js"></script>
     
<?php 
$data = $this->requestAction('/admin/reports/reports/index/');
//debug($data);
if(!empty($data)) {
?>
<div id="my_chart"></div>
<?php echo $form->create(null, array('url' => "/admin/reports")); ?>
    <fieldset class="base">
    <legend><?php __('Báo cáo doanh số bán hàng'); ?></legend>
	<?php echo $form->input('Report.choices', array('label' => __('Lựa chọn giai đoạn'))); ?>
    </fieldset>
<?php echo $bsform->end('Chọn'); ?>
<table class="graph_table" id="sometotals1" summary="Report">
  <caption>Bảng báo cáo doanh thu</caption>
  <thead>
      <tr>
        <th class="graph_id" title="Period"><?php __($data[0]['frequence']); ?></th>
        <th class="graph_value" title="Item(s)">Số lượng</th>
        <th class="graph_value" title="VND">Tổng tiền</th>
      </tr>
  </thead>
  <tbody>
  <?php 
  foreach ($data as $row){
  ?>
	  <tr>
		<td><?php echo $row['date']?></td>
		<td><?php echo $row['quantity']?></td>
		<td><?php echo empty($row['total'])? 0: (int)$row['total'];?></td>    
	  </tr>
  <?php }?>
  </tbody>
</table>

<?php 
}
?>
<script type="text/javascript">
            var data = <?php echo $header->chart_data(Set::extract("/quantity",$data),Set::extract("/total",$data),Set::extract("/date",$data),$data[0]['frequence']);?>;
            function open_flash_chart_data() {
                return JSON.stringify(data);        
            }
            swfobject.embedSWF("<?php echo $this->webroot;?>js/openflashchart/open-flash-chart.swf",'my_chart',"1000", "400", "9.0.0");
</script>
